package net.kucoe.grin.context;

import java.util.HashMap;
import java.util.Map;

import net.kucoe.grin.Strategy;

/**
 * Describes wired {@link Strategy} result type.
 * 
 * @author Vitaliy Basyuk
 */
public class ContextResult {
    
    private final Class<?> type;
    private final Map<String, ContextValidator> validators;
    
    /**
     * Constructs ContextResult.
     * 
     * @param type
     */
    public ContextResult(final Class<?> type) {
        this.type = type;
        validators = new HashMap<String, ContextValidator>();
    }
    
    /**
     * Returns the type Class<?>.
     * 
     * @return the type Class<?>.
     */
    public Class<?> getType() {
        return type;
    }
    
    /**
     * Returns the validators Map<String,ContextValidator>.
     * 
     * @return the validators Map<String,ContextValidator>.
     */
    public Map<String, ContextValidator> getValidators() {
        return validators;
    }
    
    /**
     * Applies result validator.
     * 
     * @param name
     * @param validator
     */
    public void applyValidator(final String name, final ContextValidator validator) {
        validators.put(name, validator);
    }
    
}
